/*******************************************************************************
Date: 19.02.2025

Title: "Real Effects of Centralized Markets: Evidence from Steel Futures" 

Author: Thorsten Martin

Description: This file produces the figures and tables of the paper
*******************************************************************************/

/****************************************************************************
Figures
******************************************************************************/

/****************************************************************************
Figure 1: Exchange-trading of derivatives
******************************************************************************/

use "wfe_derivative_data", replace

label var n_commodity "Commodity Futures"
label var n_all "All Derivatives"

twoway (bar n_commodity Year, fcolor(navy*.6) lcolor(navy)) (line n_all Year, yaxis(2) lcolor(maroon)) , legend(region(lcolor(white))) scheme(s2color) graphregion(fcolor(white)) 

graph export "figure_1.pdf", as(pdf) name("Graph") replace

/****************************************************************************
Figure 2: Price dispersion
******************************************************************************/

use "sample_price_dispersion", replace

estimates clear

local y cv_price
local treatment  m5_minus m4 m3 m2 t0 p1 p2 p3 p4 p5_plus m1

eststo: reghdfe `y' `treatment'  , a(product_introduction date_introduction) vce(cl date)

coefplot, order(m5_minus m4 m3 m2 m1 t0 p1 p2 p3 p4 p5_plus) omitted recast(connected) lpattern(shortdash)  keep(m* t0 p*) xline(5.5, lwidth(2) lcolor(gs13)) yline(0) vertical ytitle(CV(Price)) levels(95) ciopts(recast(rcap)) ///
scheme(s2color) graphregion(fcolor(white)) ylabel(-0.2(0.1)0.2) yscale(range(-0.25(0.1)0.25))

graph export "figure_2.pdf", as(pdf) name("Graph") replace

/****************************************************************************
Figure 3: Producer hedging
******************************************************************************/

use "sample_hedging", replace

estimates clear

local y hedge
local treatment m4y m3y m2y t0y p1y p2y p3y p4y m1y
local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 

eststo: reghdfe `y' `treatment' year_introduction#c.(`controls') , a(gvkey_introduction naics3#year_introduction)  vce(cluster gvkey)

coefplot,  order(m4y m3y m2y m1y t0y p1y p2y p3y p4y) omitted  recast(connected) lpattern(shortdash) yline(0) keep(m* t0y p*) xline(4.5, lwidth(2) lcolor(gs13))  vertical  levels(95) ciopts(recast(rcap))  ylabel(-0.6(0.3)0.6) yscale(range(-0.6(0.3)0.6)) ///
scheme(s2color) graphregion(fcolor(white)) ytitle("Hedge (1/0)")

graph export "figure_3.pdf", as(pdf) name("Graph") replace

/****************************************************************************
Figure 4: Price level
******************************************************************************/

use "sample_prices", replace

estimates clear
local y ln_price
local treatment m5_minus m4 m3 m2 t0 p1 p2 p3 p4 p5_plus m1

eststo: reghdfe `y' `treatment' , a(product_introduction date_introduction) vce(cl date)

coefplot, order(m5_minus m4 m3 m2 m1 t0 p1 p2 p3 p4 p5_plus) omitted recast(connected) lpattern(shortdash) yline(0)  keep(m* t0 p*) xline(5.5, lwidth(2) lcolor(gs13))  vertical  levels(95) ciopts(recast(rcap)) ytitle ("Ln(Price)") ///
scheme(s2color) graphregion(fcolor(white))  ylabel(-0.15(0.05)0.15) yscale(range(-0.15(0.05)0.15))

graph export "figure_4.pdf", as(pdf) name("Graph") replace

/****************************************************************************
Figure 5: Producer profits
******************************************************************************/

use  "sample_profit", replace

estimates clear

local y profit_atw 
local treatment  m5f_minus m4f m3f m2f t0f p1f p2f p3f p4f p5f_plus m1f
local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 

 eststo: reghdfe `y' `treatment' date_introduction#c.(`controls') , a(gvkey_introduction naics3#date_introduction)  vce(cluster gvkey)
 
coefplot,  order(m5f_minus m4f m3f m2f m1f t0f p1f p2f p3f p4f p5f_plus  ) omitted  recast(connected) lpattern(shortdash) yline(0) keep(m* t0f p*) xline(5.5, lwidth(2) lcolor(gs13))  vertical  levels(95) ciopts(recast(rcap))  ///
scheme(s2color) graphregion(fcolor(white)) ylabel(-0.04(0.02)0.04) yscale(range(-0.04(0.02)0.04)) ytitle("Profit")

graph export "figure_5.pdf", as(pdf) name("Graph") replace

/****************************************************************************
Figure 6: Producer stock market reaction
******************************************************************************/

use "sample_car_graph", replace

estimates clear

eststo: reghdfe car_m m9 m8 m7 m6 m5 m4 m3 m2 m1 p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 m10 , a(permno#date evttime#date) vce(cl permno evttime#date)

coefplot, order(m10 m9 m8 m7 m6 m5 m4 m3 m2 m1 p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10)  recast(connected) lpattern(shortdash) ytitle(CAR) yline(0) keep(m* t0 p*) omitted xline(10.5, lwidth(2) lcolor(gs13))  vertical  levels(95) ciopts(recast(rcap))  ylabel(-0.12(0.04)0.12) yscale(range(-0.12(0.04)0.12)) ///
scheme(s2color) graphregion(fcolor(white)) 

graph export "figure_6.pdf", as(pdf) name("Graph") replace

/****************************************************************************
Tables
******************************************************************************/

/****************************************************************************
Table 1: Summary Stastisics
******************************************************************************/

eststo clear

// Prices
use "sample_prices", replace
quietly estpost summarize treated price ln_price  , detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3)) p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label

// Price Dispersion
use "sample_price_dispersion", replace
quietly estpost summarize sd_price cv_price, detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3)) p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label

// Hedging
use "sample_hedging", replace
quietly estpost summarize treated_f hedge , detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3)) p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label

// Market Share
use "sample_market_share", replace
quietly estpost summarize market_sharew eaf , detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3))  p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label

// Profits
use  "sample_profit", replace
quietly estpost summarize profit_atw, detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3)) p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label

// Controls
quietly estpost summarize atq firmagew_pre1 sales_growthw_pre1 if period==-1 , detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3)) p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label

// CAR
use "temp_data/sample_car", replace
quietly estpost summarize treated car_m car_capm car_3f car_4f , detail
esttab using "table_1.tex", cells("count mean(fmt(3)) sd(fmt(3)) p1(fmt(3))  p50(fmt(3)) p99(fmt(3))") title("Summary Statistics")  append label
}

/****************************************************************************
Table 2: Price Dispersion
******************************************************************************/

use "sample_price_dispersion", replace

local controls_demand treated#c.(dln_outputall dln_outputautomotive dln_outputconstruction dln_outputmachines dln_outputappliances)
local controls_supply treated#c.(dln_production utilization)
local controls_trade treated#c.(dln_imports dln_world)

eststo clear
eststo: reghdfe sd_price post_treated , a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe sd_price post_treated `controls_demand', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"Yes" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe sd_price post_treated `controls_supply', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"Yes" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe sd_price post_treated `controls_trade', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"Yes" 	, replace

eststo: reghdfe sd_price post_treated `controls_demand' `controls_supply' `controls_trade', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"Yes" 	, replace
estadd local controls_supply	"Yes" 	, replace
estadd local controls_trade		"Yes" 	, replace

esttab using "table_2_panel_a.tex", se title("SD(Price) around HRC and BUS futures introduction") keep(post_treated) ///
s(product_time_fe sample controls_demand controls_supply controls_trade r2 N, label("Product and Release FE" "Sample" "Demand Controls" "Supply Controls" "Trade Controls") fmt(0 0 0 0 0 3 0)) noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace

eststo clear
eststo: reghdfe cv_price post_treated , a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe cv_price post_treated `controls_demand' , a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"Yes" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe cv_price post_treated `controls_supply', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"Yes" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe cv_price post_treated `controls_trade', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"Yes" 	, replace

eststo: reghdfe cv_price post_treated `controls_demand' `controls_supply' `controls_trade', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"Yes" 	, replace
estadd local controls_supply	"Yes" 	, replace
estadd local controls_trade		"Yes" 	, replace

esttab using "table_2_panel_b.tex", se title("CV(Price) around HRC and BUS futures introduction") keep(post_treated) ///
s(product_time_fe sample controls_demand controls_supply controls_trade r2 N, label("Product and Release FE" "Sample" "Demand Controls" "Supply Controls" "Trade Controls") fmt(0 0 0 0 0 3 0)) noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace

/****************************************************************************
Table 3: Hedging
******************************************************************************/

use "sample_hedging", replace

eststo clear
local outcome hedge  
local fe absorb(gvkey_introduction date_introduction)
local cluster cluster(gvkey)
local treatment post_treated_f
local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 

eststo: reghdfe hedge `treatment'  	, absorb(gvkey_introduction year_introduction) `cluster' 

eststo: reghdfe hedge `treatment'  	, absorb(gvkey_introduction naics3#year_introduction) `cluster' 

eststo: reghdfe hedge `treatment'  year_introduction#c.(`controls')	, absorb(gvkey_introduction naics3#year_introduction) `cluster' 

esttab using "table_3.tex", se keep(post_treated*) title("Hedging around HRC and BUS futures introduction") addnote("Controls: `controls'") ///
noconstant star(* 0.10 ** 0.05 *** 0.01) scalars(r2) b(3) label replace

/****************************************************************************
Table 4: Market Share
******************************************************************************/


use "sample_market_share", replace

local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 

eststo clear
eststo: reghdfe market_share interaction post##treated_f##eaf##c.iron_ore_to_scrap , a(gvkey date) cl(gvkey)
eststo: reghdfe market_share interaction post##treated_f##eaf##c.iron_ore_to_scrap  , a(gvkey naics3#date) cl(gvkey)
eststo: reghdfe market_share interaction post##treated_f##eaf##c.iron_ore_to_scrap date_introduction#c.(`controls') , a(gvkey naics3#date) cl(gvkey)
esttab using "table_4.tex", se keep(interaction) title("Market share around HRC futures introduction") ///
noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace

/****************************************************************************
Table 5: Prices
******************************************************************************/

use "sample_prices", replace

local controls_demand treated#c.(dln_outputall dln_outputautomotive dln_outputconstruction dln_outputmachines dln_outputappliances)
local controls_supply treated#c.(dln_production utilization)
local controls_trade treated#c.(dln_imports dln_world)

// Prices
eststo clear

eststo: reghdfe ln_price post_treated , a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe ln_price post_treated `controls_demand' , a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"Yes" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe ln_price post_treated `controls_supply' , a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"Yes" 	, replace
estadd local controls_trade		"No" 	, replace

eststo: reghdfe ln_price post_treated `controls_trade', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"No" 	, replace
estadd local controls_supply	"No" 	, replace
estadd local controls_trade		"Yes" 	, replace

eststo: reghdfe ln_price post_treated `controls_demand' `controls_supply' `controls_trade', a(product_introduction date_introduction) cl(date)
estadd local product_time_fe 	"Yes" 	, replace
estadd local sample 			"All" 	, replace
estadd local controls_demand	"Yes" 	, replace
estadd local controls_supply	"Yes" 	, replace
estadd local controls_trade		"Yes" 	, replace

esttab using "table_5.tex", se title("Price around HRC and BUS futures introduction") keep(post_treated) ///
s(product_time_fe sample controls_demand controls_supply controls_trade r2 N, label("Product and Release FE" "Sample" "Demand Controls" "Supply Controls" "Trade Controls") fmt(0 0 0 0 0 3 0)) noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace


/****************************************************************************
Table 6: Profits
******************************************************************************/

use  "sample_profit", replace

local outcome profit_atw
local fe a(gvkey_introduction date_introduction)
local cluster cluster(gvkey)
local treatment post_treated_f 
local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 

eststo clear

eststo: reghdfe `outcome' `treatment'  												, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"No" , replace
estadd local sample 		"All" , replace 

eststo: reghdfe `outcome' `treatment'  date_introduction#c.(`controls') , a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"Yes" , replace
estadd local sample 		"All" , replace 

eststo: reghdfe `outcome' `treatment' 	date_introduction#c.(`controls' b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1) , a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"Yes" , replace
estadd local sample 		"All" , replace 

eststo: reghdfe `outcome' `treatment'  		date_introduction#eaf			date_introduction#c.(`controls' b_cgis_pre1 b_ris_pre1 b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1) c.iron_ore_to_scrap#treated_f 		c.ln_iron_ore#treated_f			, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"Yes" , replace
estadd local sample 		"All" , replace 

eststo: reghdfe `outcome' `treatment'  		date_introduction#eaf	treated_f#c.(pen_imports_emp pen_imports_cij_emp)		date_introduction#c.(`controls' b_cgis_pre1 b_ris_pre1 b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1) c.iron_ore_to_scrap#treated_f  c.ln_iron_ore#treated_f					, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"Yes" , replace
estadd local sample 		"All" , replace 

eststo: reghdfe `outcome' `treatment'  		date_introduction#eaf	treated_f#c.(pen_imports_emp pen_imports_cij_emp)		date_introduction#c.(`controls' b_cgis_pre1 b_ris_pre1 b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1 share_main_pre1 share_foreign_pre1 ) c.iron_ore_to_scrap#treated_f  c.ln_iron_ore#treated_f					, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"Yes" , replace
estadd local sample 		"All" , replace 

eststo: reghdfe `outcome' `treatment'  		date_introduction#eaf	treated_f#c.(pen_imports_emp pen_imports_cij_emp)		date_introduction#c.(`controls' b_cgis_pre1 b_ris_pre1 b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1 share_main_pre1 share_foreign_pre1 ) c.iron_ore_to_scrap#treated_f  c.ln_iron_ore#treated_f		if Ltrim_acquisitions == 0			, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local firm_fe 		"Yes" , replace
estadd local ind_fe 		"Yes" , replace
estadd local controls		"Yes" , replace
estadd local sample 		"All" , replace 

esttab using "table_7.tex", se keep(post_treated_f) title("Profit around HRC and BUS futures introduction") ///
s(firm_fe ind_fe controls sample r2 N, label("Firm and YQ FE" "3-digit NAICSxYQ FE" "YQxControls" "Sample") fmt(0 0 0 0 3 0)) addnote(Controls: ) ///
noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace


/****************************************************************************
Table 7: CAR
******************************************************************************/

use "sample_car"

eststo: reghdfe car_m treated , a(permno date) cluster(permno)
estadd local firm_fe 		"Yes" , replace
estadd local date_fe 		"Yes" , replace
estadd local model			"m" , replace

eststo: reghdfe car_capm treated , a(permno date) cluster(permno)
estadd local firm_fe 		"Yes" , replace
estadd local date_fe 		"Yes" , replace
estadd local model			"capm" , replace

eststo: reghdfe car_3f treated , a(permno date) cluster(permno)
estadd local firm_fe 		"Yes" , replace
estadd local date_fe 		"Yes" , replace
estadd local model			"3f" , replace

eststo: reghdfe car_4f treated , a(permno date) cluster(permno)
estadd local firm_fe 		"Yes" , replace
estadd local date_fe 		"Yes" , replace
estadd local model			"4f" , replace

esttab using "table_7.tex", se keep(treated) title("CAR around HRC and BUS futures announcements") ///
s(firm_fe date_fe model r2 N, label("Firm FE" "Date FE" "Model") fmt(0 0 0 3 0)) ///
noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace


/****************************************************************************
Table 8: HRC & BUS futures introductions separately
******************************************************************************/

// HRC
eststo clear

use "sample_price_dispersion", replace
eststo: reghdfe sd_price post_treated if introduction == 2008	 , a(product_introduction date_introduction) vce(cl date)
estadd local fe 				"Yes" 	, replace
estadd local sample 			"2008" 	, replace

eststo: reghdfe cv_price 			post_treated  if introduction == 2008	 , a(product_introduction date_introduction) vce(cl date)
estadd local fe 				"Yes" 	, replace
estadd local sample 			"2008" 	, replace

use "sample_hedging", replace
eststo: reghdfe hedge post_treated_f if introduction == 2008, absorb(gvkey_introduction year_introduction) cluster(gvkey)
estadd local fe 			"Yes" , replace
estadd local sample 		"2008" , replace 

use "sample_prices", replace
eststo: reghdfe ln_price post_treated  if introduction == 2008, a(product_introduction date_introduction) cl(date)
estadd local fe 				"Yes" 	, replace
estadd local sample 			"2008" 	, replace

use  "sample_profit", replace
local fe a(gvkey_introduction date_introduction)
local cluster cluster(gvkey)
local treatment post_treated_f 
local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 
eststo: reghdfe profit_atw `treatment'  date_introduction#eaf treated_f#c.(pen_imports_emp pen_imports_cij_emp)		date_introduction#c.(`controls' b_cgis_pre1 b_ris_pre1 b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1 share_main_pre1 share_foreign_pre1 )	c.iron_ore_to_scrap#treated_f c.ln_iron_ore#treated_f 	if introduction == 2008	, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local fe 			"Yes" , replace
estadd local sample 		"2008" , replace 

esttab using "table_8_panel_a.tex", se keep(post_treated*) title("Product and Firm-Level Outcomes around HRC introduction")  ///
noconstant star(* 0.10 ** 0.05 *** 0.01) scalars(r2) b(3) label replace

// BUS
eststo clear

use "sample_price_dispersion", replace
eststo: reghdfe sd_price post_treated if introduction == 2012	 , a(product_introduction date_introduction) vce(cl date)
estadd local fe 				"Yes" 	, replace
estadd local sample 			"2012" 	, replace

eststo: reghdfe cv_price 			post_treated  if introduction == 2012	 , a(product_introduction date_introduction) vce(cl date)
estadd local fe 				"Yes" 	, replace
estadd local sample 			"2012" 	, replace

use "sample_hedging", replace
eststo: reghdfe hedge post_treated_f if introduction == 2012, absorb(gvkey_introduction year_introduction) cluster(gvkey)

use "sample_prices", replace
eststo: reghdfe ln_price post_treated  if introduction == 2012, a(product_introduction date_introduction) cl(date)
estadd local fe 				"Yes" 	, replace
estadd local sample 			"2012" 	, replace

use  "sample_profit", replace

local fe a(gvkey_introduction date_introduction)
local cluster cluster(gvkey)
local treatment post_treated_f 
local controls ln_atw_pre1 firmagew_pre1 sales_growthw_pre1 
eststo: reghdfe profit_atw `treatment'  date_introduction#eaf treated_f#c.(pen_imports_emp pen_imports_cij_emp)		date_introduction#c.(`controls' b_cgis_pre1 b_ris_pre1 b_sgall_pre1 b_sgmotor_veh_pre1 b_sgconstr_pre1 b_sgmachinery_pre1 b_sgappliances_pre1 share_main_pre1 share_foreign_pre1 )	c.iron_ore_to_scrap#treated_f c.ln_iron_ore#treated_f 	if introduction == 2012	, a(gvkey_introduction naics3#date_introduction) `cluster' 
estadd local fe 			"Yes" , replace
estadd local sample 		"2012" , replace 

esttab using "table_8_panel_b.tex", se keep(post_treated*) title("Product and Firm-Level Outcomes around BUS introduction")  ///
noconstant star(* 0.10 ** 0.05 *** 0.01) scalars(r2) b(3) label replace

/****************************************************************************
Table 9: Placebo - Non-US firms
******************************************************************************/


* Hedge (1/0)
use "sample_hedging_placebo", replace
eststo: reghdfe hedge post_treated_f  , absorb(gvkey_introduction giso#year_introduction) cluster(gvkey)

* Market Share
use "sample_market_share_placebo", replace
eststo: reghdfe market_share interaction post##treated_f##eaf##c.iron_ore_to_scrap , a(gvkey giso#date) cl(gvkey)

* Profit
use  "sample_profit_placebo", replace
eststo: reghdfe profit_atw post_treated_f , a(gvkey_introduction giso##naics3##date_introduction) cluster(gvkey)

* CAR
use "sample_car_placebo", replace
eststo: reghdfe car_m treated , a(gvkey giso#date) cluster(gvkey)
esttab using "table_9.tex", se keep(post_treated_f interaction treated) title("Placebo") ///
s(r2 N, fmt(3 0)) ///
noconstant star(* 0.10 ** 0.05 *** 0.01) label scalars(r2) b(3) replace

